﻿@model WaiGaoQiaoWeb.Models.FundsOperatingDetailsReportVM
@{
    ViewBag.Title = "FundsOperatingDetailsReportIndex";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section Head
{
    @Html.Css("EditForm")
    @Html.Js("datepicker")
    @Html.Css("dp")
    <script type="text/javascript">
        var mainheight = document.documentElement.clientHeight;
        var mainWidth = document.documentElement.clientWidth;
        $(document).ready(function () {
            var otherpm = $("#title").height() + $("#findDiv").height(); // 290;
            var gh = mainheight - otherpm - 60;
            var option = {
                height: gh,
                width: mainWidth,
                url: '@Url.Action("GetList")',
                colModel: [
                    { display: 'ID', name: 'ID', width: 60, sortable: false, align: 'left', hide: true, iskey: true },
                    { display: '日期时间', width: 150, sortable: false, hide: false, align: 'left' },
                    { display: '部门名称', width: 120, sortable: false, hide: false, align: 'left' },
			        { display: '人员编号', width: 50, sortable: false, hide: false, align: 'left' },
                    { display: '姓名', width: 50, sortable: false, hide: false, align: 'left' },
                    { display: '金额', width: 100, sortable: false, hide: false, align: 'left' },
                    { display: '增项减项', width: 50, sortable: false, hide: false, align: 'left' },
                    { display: '增减名称', width: 100, sortable: false, hide: false, align: 'left' },
                    { display: '操作后余额', width: 100, sortable: false, hide: false, align: 'left' }
				],
                singleselected: true,
                sortname: "Sequence",
                sortorder: "asc",
                title: false,
                usepager: true,
                page: 1,
                rp: 20,
                rpOptions: [10, 15, 20],
                showcheckbox: true,
                rowbinddata: true,
                query: $("#StartTime").val() + "," + $("#EndTime").val() + ","
                             + $("#DEP_ID :selected").val() + "," + $("#EMPNO").val() + "," + $("#PNAME").val() + "," + $("#GroupIdDept :selected").val() + "," + $("#DepositName :selected").val()
            };
            $("#FundsOperatingList").flexigrid(option);
            function SelectClick() {
                option.query = $("#StartTime").val() + "," + $("#EndTime").val() + ","
                             + $("#DEP_ID :selected").val() + "," + $("#EMPNO").val() + "," + $("#PNAME").val() + "," + $("#GroupIdDept :selected").val() + "," + $("#DepositName :selected").val();
                option.newp = 0;
                $("#FundsOperatingList").flexOptions(option).flexReload();
            }
            $("#btnQueryList").click(function () {
                SelectClick();
            });
            $("#StartTime").bind('keydown', function (e) {
                var key = e.which;
                if (key == 13) {
                    e.preventDefault();
                    SelectClick();
                }
            });
            $("#EndTime").bind('keydown', function (e) {
                var key = e.which;
                if (key == 13) {
                    e.preventDefault();
                    SelectClick();
                }
            });
            $("#PNAME").bind('keydown', function (e) {
                var key = e.which;
                if (key == 13) {
                    e.preventDefault();
                    SelectClick();
                }
            });
            $("#EMPNO").bind('keydown', function (e) {
                var key = e.which;
                if (key == 13) {
                    e.preventDefault();
                    SelectClick();
                }
            });
            $("#DEP_ID").bind('keydown', function (e) {
                var key = e.which;
                if (key == 13) {
                    e.preventDefault();
                    SelectClick();
                }
            });
            $("#GroupIdDept").bind('keydown', function (e) {
                var key = e.which;
                if (key == 13) {
                    e.preventDefault();
                    SelectClick();
                }
            });
            $("#DEP_ID").change(function (e) {
                var vdepid = $("#DEP_ID :selected").val();
                $.ajax({
                    type: "POST",
                    url: '@Url.Action("GetGroupDeptChange")',
                    data: { depid: vdepid },
                    dataType: "json",
                    async: true,
                    success: function (data) {
                        $("#GroupIdDept").empty();
                        var t = $("#GroupIdDept")
                        for (var i in data) {
                            var x = data[i];
                            t.append("<option value='" + x.Value + "'>" + x.Text + "</option>");
                        }
                    },
                    error: function () { }
                });
            });
            $("#btnExport").click(function () {
                var vstarttime = $("#StartTime").val();
                var vendtime = $("#EndTime").val();
                var vdepid = $("#DEP_ID :selected").val();
                var vempno = $("#EMPNO").val();
                var vpname = $("#PNAME").val();
                var vgroupid = $("#GroupIdDept :selected").val();
                var vdepositname = $("#DepositName :selected").val();
                var strulr = "ReportOut?StartTime=" + vstarttime + "&EndTime=" + vendtime + "&DEP_ID=" + vdepid + "&EMPNO=" + vempno + "&PNAME=" + vpname + "&GroupId=" + vgroupid + "&DepositName=" + vdepositname;
                var subwin = window.open(strulr, "", "menubar=no,toolbar=no,status=no,resizable=no,scrollbars=yes");
                subwin.moveTo(0, 0);
                subwin.resizeTo(window.screen.availWidth, window.screen.availHeight);
                return false;
            });
        });
    </script>
}
<div id="container">
    <div id="mainContent">
        <div id="title" class="title">
            增减款记录表</div>
        <div id="findDiv">
            <table>
                <tr>
                    <td style="text-align: right; width: 80px;">
                        开始日期：
                    </td>
                    <td>
                        @Html.TextBox("StartTime", DateTime.Now.Date.ToString("yyyy-MM-dd") + " 00:00:00", new { @ReadOnly = true, @style = "width:140px;", @class = "Wdate", onfocus = "WdatePicker({vel:'C1SignInTime.BeginTime',dateFmt:'yyyy-MM-dd HH:mm:ss'})" })
                    </td>
                    <td style="text-align: right; width: 80px;">
                        结束日期：
                    </td>
                    <td>
                        @Html.TextBox("EndTime", DateTime.Now.Date.ToString("yyyy-MM-dd") + " 23:59:59", new { @ReadOnly = true, @style = "width:140px;", @class = "Wdate", onfocus = "WdatePicker({vel:'C1SignInTime.BeginTime',dateFmt:'yyyy-MM-dd HH:mm:ss'})" })
                    </td>
                    <td style="text-align: right; width: 80px;">
                        姓名：
                    </td>
                    <td>
                        @Html.TextBoxFor(model => model.PNAME, new { @style = "width:140px;" })
                    </td>
                </tr>
                <tr>
                    <td style="text-align: right; width: 80px;">
                        人员编号：
                    </td>
                    <td>@Html.TextBoxFor(model => model.EMPNO, new { @style = "width:140px;" })
                    </td>
                    <td style="text-align: right; width: 80px;">
                        部门名称:
                    </td>
                    <td>
                        @Html.DropDownListFor(model => model.DEP_ID,
                                   ViewData["Deptment"] as IEnumerable<SelectListItem>,
                                   new { @style = "width:150px; height:22px; font-size:13px;" })
                    </td>
                    <td style="text-align: right; width: 80px;">
                        班组：
                    </td>
                    <td>
                        @Html.DropDownListFor(model => model.GroupIdDept,
                                   ViewData["GroupDept"] as IEnumerable<SelectListItem>,
                                   new { @style = "width:150px; height:22px; font-size:13px;" })
                    </td>
                </tr>
                <tr>
                    <td style="text-align: right; width: 80px;">
                        增减名称：
                    </td>
                    <td>@Html.DropDownListFor(model => model.DEPOSITNAME,
                                    ViewData["DepositTypeID"] as IEnumerable<SelectListItem>,
                                    new { @style = "width:150px; height:22px; font-size:13px;" })
                    </td>
                    <td colspan="4">
                        <a id="btnQueryList" class="button" href="javascript:void(0);"><span>查 询</span></a>
                        <a id="btnExport" class="button" href="javascript:void(0);"><span>导 出</span></a>
                    </td>
                </tr>
            </table>
        </div>
        <table id="FundsOperatingList" style="display: none;">
        </table>
    </div>
</div>
